'''
Created on 17/10/2011

@author: nacho
'''



class Timer():
    '''
    classdocs
    '''

    def __init__(self,maximo):
        
       
        self.counter=0
        self.maxTime=maximo
       
    def click(self,so,readyQ):
        
        self.counter +=1
        
        if self.counter == self.maxTime:
            
            self.notify(so,readyQ)
            print("Processes are getting old")
            self.restart()
    
    def restart(self):
        
        self.counter=0    
    
    def notify(self,so,readyQ):
        
        for pid in readyQ:
            
            so.toMature(pid)